/**
 * Class: Dot2D
 *
 * Purpose: 
 *
 * Created: Jan 27, 2010 @ 9:37:10 AM
 * @author Ken Scott
 */
package org.openfantasia.ps.actor;

import org.openfantasia.ps.particle.Particle;
import org.openfantasia.ui.PColor;
import org.openfantasia.ui.PFrame;

public class Ball extends Actor {

	protected float radius = 1f;


	public Ball(PFrame frame) {
		super(frame);
	}


	public Ball(PFrame frame, float radius) {
		super(frame);
		this.radius = radius;
	}


	public void draw(Particle particle) {
		PColor color = particle.getFillColor();
		PColor scaledColor = color.scale((float) particle.getBrightness());
		PColor solidifiedColor = scaledColor.opacify((float) particle.getOpacity());
		frame.fill(solidifiedColor);
		float[] pos = particle.getPosition().toFloat();
		frame.translate(pos[0], pos[1], pos[2]);
		frame.sphere(radius);
		frame.translate(-pos[0], -pos[1], -pos[2]);
	}
}